/*	<!-- This code written by : Willie Wheeler and John Wheeler -->
	<!-- For 'Spring In Practice' [Book written by Willie Wheeler and John Wheeler] -->
*/
$(function() {

	// Register focus/blur listeners
	$('#mainForm :input:not(:hidden, :submit)').focus(function(event) {
		var target = event.target ? event.target : event.srcElement;
		$(target).addClass('selected-form-field');
	});
	$('#mainForm :input:not(:hidden, :submit)').blur(function(event) {
		var target = event.target ? event.target : event.srcElement;
		$(target).removeClass('selected-form-field');
	});
	
	// Set focus
	if ($('#mainForm .form-error-field').size() > 0) {
		$('#mainForm .form-error-field:first').focus();
	} else {
		$('#mainForm :input:not(:hidden, :submit):first').focus();
	}
	
	// Fade alerts in
	$('.alert-box').fadeIn('slow');
});
